Type Parameter練習コード
#Go言語 Go言語のType Parameter
typelistの埋め込み https://go2goplay.golang.org/p/ZFcFIhE2-l-
code: embed_typelist.go
package main
import (
"fmt"
)
type C1 interface {
type int, uint
}
type C2 interface {
type int, float64
}
type C3 interface {
C1
C2
}
func PrintT C3(s T) {
fmt.Printf("%T\n", s)
}
type MyInt int
type MyUInt uint
func main() {
var x MyUInt = 1
Print(x)
}